<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of JSONController
 *
 * @author Marek S
 */
class JSONController extends Controller{
    protected function convertViewToResult(){
        $this->result->view = (string)$this->view;
    }
    
    protected final function postExecute() {
        parent::postExecute();
        $this->getResult();
    }
    
    public function __construct() {
        parent::__construct();
        $this->result = new stdClass();
    }
    
    public function getResult() {
        if($this->view->isExists()){
            $this->convertViewToResult();
        }
        echo json_encode($this->result);
        die;
    }
}
